<template>
  <div id="app">
    <button @click="sendRequest">发送请求</button>
  </div>
</template>

<script>
import axios from 'axios';
axios.defaults.baseURL = 'http://localhost:8080';

export default {
  name: 'App',
  components: {
  },
  methods: {
    async sendRequest() {
      try {
        await new Promise(resolve => setTimeout(resolve, 3000));
        
        const response = await axios({
          method: 'post',
          url: '/test',
          headers: {
            token: '123'
          },
          params: {
            name: 'test',
            age: 20
          },
          data: {
            message: 'Hello'
          },
          responseType: 'json',
          timeout: 3000
        });
        
        console.log('请求成功：', response.data);
      } catch (error) {
        console.error('请求失败：', error);
      }
    }
  }
}
</script>

<style>

</style>
